package com.kefu.robot.vo;

import org.apache.commons.lang3.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractSearchVo;
import com.kefu.robot.model.RobotAidataInfo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xiaoyu
 * @date 2023/11/03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "AI模型信息")
public class RobotAidataInfoSearchVo extends AbstractSearchVo {

    @ApiModelProperty(value = "名称")
    private String aidataName;
    @ApiModelProperty(value = "状态 0：未启用 1：启用")
    private String state;
    @ApiModelProperty(value = "创建人")
    private String createUser;
    @ApiModelProperty(value = "创建时间开始")
    private Long createTimeStart;
    @ApiModelProperty(value = "创建时间结束")
    private Long createTimeEnd;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "修改人")
    private String updateUser;
    @ApiModelProperty(value = "修改时间开始")
    private Long updateTimeStart;
    @ApiModelProperty(value = "修改时间结束")
    private Long updateTimeEnd;

    @Override
    public LambdaQueryWrapper<RobotAidataInfo> lambdaQuery() {
        LambdaQueryWrapper<RobotAidataInfo> wrapper = Wrappers.<RobotAidataInfo>lambdaQuery();
        wrapper.like(StringUtils.isNotBlank(aidataName), RobotAidataInfo::getAidataName, aidataName);
        wrapper.eq(StringUtils.isNotBlank(state), RobotAidataInfo::getState, state);
        wrapper.eq(StringUtils.isNotBlank(createUser), RobotAidataInfo::getCreateUser, createUser);
        wrapper.ge(createTimeStart != null, RobotAidataInfo::getCreateTime, createTimeStart);
        wrapper.le(createTimeEnd != null, RobotAidataInfo::getCreateTime, createTimeEnd);
        wrapper.eq(StringUtils.isNotBlank(remark), RobotAidataInfo::getRemark, remark);
        wrapper.eq(StringUtils.isNotBlank(updateUser), RobotAidataInfo::getUpdateUser, updateUser);
        wrapper.ge(updateTimeStart != null, RobotAidataInfo::getUpdateTime, updateTimeStart);
        wrapper.le(updateTimeEnd != null, RobotAidataInfo::getUpdateTime, updateTimeEnd);
        wrapper.eq(RobotAidataInfo::getTenantId, KefuContext.getKefuContext().getTenantId());

        return wrapper;
    }
}